package org.gap.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import java.util.LinkedHashSet;
import java.util.Set;

import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */

@Entity
@NamedQueries({
		@NamedQuery(name = "findAllRoless", query = "select myRoles from Roles myRoles"),
		@NamedQuery(name = "findRolesByPrimaryKey", query = "select myRoles from Roles myRoles where myRoles.rolRole = ?1"),
		@NamedQuery(name = "findRolesByRolDescription", query = "select myRoles from Roles myRoles where myRoles.rolDescription = ?1"),
		@NamedQuery(name = "findRolesByRolDescriptionContaining", query = "select myRoles from Roles myRoles where myRoles.rolDescription like ?1"),
		@NamedQuery(name = "findRolesByRolPhysiqueMorale", query = "select myRoles from Roles myRoles where myRoles.rolPhysiqueMorale = ?1"),
		@NamedQuery(name = "findRolesByRolPhysiqueMoraleContaining", query = "select myRoles from Roles myRoles where myRoles.rolPhysiqueMorale like ?1"),
		@NamedQuery(name = "findRolesByRolRole", query = "select myRoles from Roles myRoles where myRoles.rolRole = ?1"),
		@NamedQuery(name = "findRolesByRolRoleContaining", query = "select myRoles from Roles myRoles where myRoles.rolRole like ?1") })
@Table(schema = "GAP", name = "ROLES")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "GAP_v2/org/gap/domain", name = "Roles")
@XmlRootElement(namespace = "GAP_v2/org/gap/domain")
public class Roles implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "ROL_ROLE", length = 3, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	String rolRole;
	/**
	 */

	@Column(name = "ROL_DESCRIPTION", length = 40)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String rolDescription;
	/**
	 */

	@Column(name = "ROL_PHYSIQUE_MORALE", length = 1)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String rolPhysiqueMorale;

	/**
	 */
	@OneToMany(mappedBy = "roles", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)
	@XmlElement(name = "", namespace = "")
	java.util.Set<org.gap.domain.RolesTiers> rolesTierses;

	/**
	 */
	public void setRolRole(String rolRole) {
		this.rolRole = rolRole;
	}

	/**
	 */
	public String getRolRole() {
		return this.rolRole;
	}

	/**
	 */
	public void setRolDescription(String rolDescription) {
		this.rolDescription = rolDescription;
	}

	/**
	 */
	public String getRolDescription() {
		return this.rolDescription;
	}

	/**
	 */
	public void setRolPhysiqueMorale(String rolPhysiqueMorale) {
		this.rolPhysiqueMorale = rolPhysiqueMorale;
	}

	/**
	 */
	public String getRolPhysiqueMorale() {
		return this.rolPhysiqueMorale;
	}

	/**
	 */
	public void setRolesTierses(Set<RolesTiers> rolesTierses) {
		this.rolesTierses = rolesTierses;
	}

	/**
	 */
	public Set<RolesTiers> getRolesTierses() {
		if (rolesTierses == null) {
			rolesTierses = new java.util.LinkedHashSet<org.gap.domain.RolesTiers>();
		}
		return rolesTierses;
	}

	/**
	 */
	public Roles() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(Roles that) {
		setRolRole(that.getRolRole());
		setRolDescription(that.getRolDescription());
		setRolPhysiqueMorale(that.getRolPhysiqueMorale());
		setRolesTierses(new java.util.LinkedHashSet<org.gap.domain.RolesTiers>(that.getRolesTierses()));
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("rolRole=[").append(rolRole).append("] ");
		buffer.append("rolDescription=[").append(rolDescription).append("] ");
		buffer.append("rolPhysiqueMorale=[").append(rolPhysiqueMorale).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((rolRole == null) ? 0 : rolRole.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof Roles))
			return false;
		Roles equalCheck = (Roles) obj;
		if ((rolRole == null && equalCheck.rolRole != null) || (rolRole != null && equalCheck.rolRole == null))
			return false;
		if (rolRole != null && !rolRole.equals(equalCheck.rolRole))
			return false;
		return true;
	}
}
